/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.util;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import org.primefaces.extensions.component.masterdetail.SelectLevelEvent;

/**
 *
 * @author jasuke
 */
@ManagedBean
@RequestScoped
public class SelectLevelListener {

    private boolean errorOccured = false;  
  
    public int handleNavigation(SelectLevelEvent selectLevelEvent) {  
        if (errorOccured) {  
            return 2;  
        } else {  
            return selectLevelEvent.getNewLevel();  
        }  
    }  
  
    public void setErrorOccured(boolean errorOccured) {  
        this.errorOccured = errorOccured;  
    }  
}
